<!DOCTYPE html>
<html lang="th">
<head>
    <meta charset="utf-8">
    
    <title>P2DC เชียงใหม่ บริการวาง Server, Hosting, VPS ครบวงจร</title>
    <meta name="description" content="P2DC เชียงใหม่ บริการวาง Server, Hosting, VPS ครบวงจร" />
    <meta name="keywords" content="server เชียงใหม่, วาง server เชียงใหม่, รับฝาก server เชียงใหม่, data center เชียงใหม่, ฝาก hosting เชียงใหม่, hosting เชียงใหม่" />
    <meta http-equiv="content-language" content="th" />
    <meta name="revisit-after" content="1 days" />
    <meta name="robots" content="index, follow" />
    
    <meta property="og:image" content="http://www.p2dc.com/images/p2dc.png"/>
    <meta property="og:title" content="P2DC เชียงใหม่ บริการวาง Server, Hosting, VPS ครบวงจร"/>
    <meta property="og:url" content="http://www.p2dc.com"/>
    <meta property="og:site_name" content="P2DC"/>
    <meta property="og:type" content="blog"/>
    <meta property="og:description" content="Internet Data Center at Chiang Mai Thailand , idc เชียงใหม่ , วาง Server เชียงใหม่ , colo เชียงใหม่ , vps , web hosting , จด domain" />
    
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="viewport" content="width=960">

    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
    
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    
	<link href="css/smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet">
	<script src="js/jquery-ui-1.10.3.custom.js"></script>

	<script type="text/javascript" src="fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>

	<!-- Add fancyBox -->
	<link rel="stylesheet" href="fancybox/source/jquery.fancybox.css?v=2.1.4" type="text/css" media="screen" />
	<script type="text/javascript" src="fancybox/source/jquery.fancybox.pack.js?v=2.1.4"></script>
	<style type="text/css">
	.clear { clear: both; }
	.container { width: 960px; }
	.header { height: 352px; }
	*, .btn {
		text-shadow: 0 1px 0 rgba(255,255,255,0.33);
	}
	.gray-shadow-block, .gray-shadow-block li {
		font-size: 16px;
		line-height: 26px;
	}
	
	.gray-shadow-block {
		background: #f3f3f3;
		box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.33);
		border-radius: 10px;
		overflow: hidden;
	}
	
	.center-block {
		margin: auto auto;
		width: 840px;
	}
	
	.table-bordered th:not(:first-child), .table-bordered td:not(:first-child) {
		border-left: 1px solid black;
	}
	
	.table.center-block thead {
		-webkit-border-radius: 10px 10px 0 0;
		-moz-border-radius: 10px 10px 0 0;
		border-radius: 10px 10px 0 0;
	}
	
	.label-important, .badge-important {
		background-color: #F00;
	}
	
	textarea {
		resize: none; 
		min-height: 40px;
		min-width: 100px;
	}
	</style>
</head>
<body>
<div class="container" id="page">
	<?php
	$page = '';
	$page = empty($_GET['page']) ? 'home' : $_GET['page'];
	$pageArr = explode('/', $page);
	if($pageArr[0] != 'accounting' && $pageArr[0] != 'technic'){
	?>
	<style type="text/css">
	.container { width: 960px; }
	.header { height: 352px; }
	
	.body {
		min-height: 600px;
	}
	
	.body.body-shadow {
		padding: 50px 0 16px 0;
		background: url(images/Shadow.png) 0 0 no-repeat;
	}
	
	.modalLogin {
		overflow: hidden;
	}
	
	.modalLogin .modal-header {
		background: #3EA73B;
	}
	
	.block-center {
		width: 840px;
		margin: auto auto;
	}
	</style>
	<div class="header">
		<a href="index.php?page=home">
			<img src="images/Header.png">
		</a>
	</div>
	
	<?php
	if($page == 'home'){
		$linkActive = 'home';
	}
	else if($page == 'colocation') {
		$linkActive = 'colocation';
	}
	else if($page == 'vps') {
		$linkActive = 'vps';
	}
	else if($page == 'hosting') {
		$linkActive = 'hosting';
	}
	else if($page == 'contact') {
		$linkActive = 'contact';
	}
	else if($page == 'login') {
		$linkActive = 'login';
	}
	else if($pageArr[0] == 'user') {
		$linkActive = 'user';
	}
	else {
		$linkActive = '';
	}
	?>
	
	<script type="text/javascript">
	/*
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-37675183-1']);
	_gaq.push(['_trackPageview']);
	(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();
	*/
	</script>
	<!--Start of Zopim Live Chat Script-->
	<script type="text/javascript">
	/*
	window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
	d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
	_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');
	$.src='//cdn.zopim.com/?1EvIMvkGixkD3FcuPoiwkvlzs9Zqn5uf';z.t=+new Date;$.
	type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
	*/
	</script>
	<!--End of Zopim Live Chat Script-->
	
	<style type="text/css">
	.modalLogin .message {
		color: red;
	}
	</style>

	<div class="modal hide fade modalLogin">
		<div class="loginBlock fade in">
			  <div class="modal-header">
			    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			    <h3>Login</h3>
			  </div>
			  <div class="modal-body">
			  	<div class="alert hide fade loginMessage"></div>
			    <form method="POST" class="form form-login" style="margin: 0;">
					<div class="pull-left" style="margin-top: 6px;">
						<p><strong>หากคุณยังไม่ได้เป็นสมาชิก</strong></p>
						<p>เพียงสมัครสมาชิกกับเรา คุณก็สามารถ<br />สั่งซื้อบริการได้อย่างรวดเร็วและปลอดภัย</p>
						<a href="index.php?page=register" target="_blank" class="swapRegister">สมัครสมาชิก</a>
					</div>
					<div class="pull-left" style="width: 260px; margin-left: 20px;">
				    	<label>email</label>
				    	<input type="email" name="email" class="email" placeholder="" /> <span class="message email-message fade"></span>
				    	<label>password</label>
				    	<input type="password" name="password" class="password" placeholder="" /> <span class="message password-message fade"></span>
						<p style="margin: 0;">
							<a href="index.php?page=resetPassword">ลืม password</a><br />
							<a href="index.php?page=resetVerifyEmail">ส่งอีเมลล์ยืนยันตัวตนอีกครั้ง</a>
						</p>
					</div>
					<button type="submit" style="width: 0; height: 0; overflow: hidden; padding: 0; margin: 0; border: none; box-shadow: none; opacity: 0;">
						submit
					</button>
					<div class="clear"></div>
				</form>
			  </div>
			  <div class="modal-footer">
			    <button class="btn btn-primary loginButton">Login</button>
			  </div>
		</div>
		<div class="registerBlock hide fade">
			<div class="modal-header">
			    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			    <h3>Registration</h3>
			  </div>
			  <div class="modal-body">
			  	<div class="alert hide fade registerMessage"></div>
			    <form method="POST" class="registerForm" style="margin: 0;">
					<label>email:</label> <input type="email" name="email" class="email" placeholder="ex: example@hotmail.com" />
					<span class="message email-message fade"></span><br />
					<label>password:</label> <input type="password" name="password" class="password" placeholder="รหัสผ่าน 4-16 หลัก" />
					<span class="message password-message fade"></span><br />
					<label>repeat-password:</label> <input type="password" name="repeat-password" class="repeat-password" />
					<span class="message repeatPassword-message fade"></span><br />
					<label>ชื่อ - นามสกุล</label>
					<input type="text" name="name" class="name" />
					<span class="message name-message fade"></span><br />
					<label>ที่อยู่</label>
					<textarea name="address" class="address"></textarea>
					<span class="message address-message fade"></span><br />
					<label>phone:</label> <input type="text" name="phone" class="phone" placeholder="ตัวเลข 10 หลักเท่านั้น" style="margin: 0" />
                    <span class="message phone-message fade"></span>
				</form>
			  </div>
			  <div class="modal-footer">
			    <button class="btn btn-primary registerButton">Submit</button>
			  </div>
		</div>
	</div>
	
	<style type="text/css">
	.nav-item {
		width: 126px;
	}
	
	#sectionMenu .nav-item > a {
		font-weight: bold;
		font-size: 16px;
		color: #8d8d8d;
		text-decoration: none;
	}
	
	#sectionMenu {
		position: relative;
	}
	
	#sectionMenu .dropdown .caret {
		margin-top: 17px;
	}
	
	#sectionMenu > .nav-item {
		line-height: 40px;
	}
	
	#sectionMenu .dropdown {
		position: static;
	}
	
	#sectionMenu .dropdown .dropdown-menu {
		background: none;
		border: none;
		box-shadow: none;
	}
	
	#sectionMenu .nav-item.active > a, #sectionMenu .nav-item > a:hover {
		background: none;
		color: #069701;
	}
	
	#sectionMenu .nav-item.active .dropdown-menu {
		display: block;
	}
	
	#sectionMenu .dropdown .dropdown-menu li {
		display: inline-block;
		text-align: center;
		width: 126px;
		padding: 0 5px;
	}
	
	#sectionMenu .dropdown .dropdown-menu li a {
		line-height: 28px;
	}

    .remoteMenu {
        position: fixed;
        background: white;
        padding: 10px;
        top: 4px;
        right: 4px;
        border: 2px solid blue;
    }
	</style>
    <?php
    if(Authenticate::isRemote()){
    $accountRemote = Account::instance()->getOne(Authenticate::getId());
    ?>
    <div class="remoteMenu">
        คุณกำลัง remote user<br />
        <?php echo $accountRemote['email'].'<br />';?>
        <?php echo empty($accountRemote['name'])? '': $accountRemote['name'].'<br />';?>
        <a href="index.php?page=remote.logout">Remote Logout</a>
    </div>
    <?php }?>
    <ul id="sectionMenu" class="inline" style="margin: 0 auto; width: 556px;">
    	<li class="nav-item text-center <?php if($linkActive == 'home'){ echo 'active'; }?>"><a href="index.php?page=home">หน้าแรก</a></li>
    	<li class="nav-item text-center dropdown <?php if($linkActive == 'colocation' || $linkActive == 'vps' || $linkActive == 'hosting'){ echo 'active'; }?>">
    		<a class="dropdown-toggle" href="#" data-toggle="dropdown">
    			บริการ
    			<b class="caret"></b>
    		</a>
    		<ul class="dropdown-menu" role="menu">
    			<li class="nav-item text-center <?php if($linkActive == 'colocation'){ echo 'active'; }?>"><a href="index.php?page=colocation">Colocation</a></li>
		    	<li class="nav-item text-center <?php if($linkActive == 'vps'){ echo 'active'; }?>"><a href="index.php?page=vps">VPS</a></li>
		    	<li class="nav-item text-center <?php if($linkActive == 'hosting'){ echo 'active'; }?>"><a href="index.php?page=hosting">Hosting</a></li>
    		</ul>
    	</li>
    	<li class="nav-item text-center <?php if($linkActive == 'contact'){ echo 'active'; }?>"><a href="index.php?page=contact">ติดต่อ</a></li>
		<?php if(Authenticate::isLogin()){?>
		<li class="nav-item text-center <?php if($linkActive == 'user'){ echo 'active'; }?>">
			<a class="linkToProfile" href="index.php?page=user/profile">หน้าส่วนตัว</a>
			<?php
				$db = Db::getInstance();
				$id = Authenticate::getId();
				$query = "SELECT (SELECT COUNT(*) FROM Invoice WHERE accountId='{$id}' AND DATE(dateDue)>=NOW() AND status='0') AS cInvoice";
				$result = $db->query($query);
				if(!$result){
					echo $db->error;
				}
				$arr = $result->fetch_assoc();
				$notifyUser = $arr['cInvoice'];
				if($notifyUser>0){?>
					<span class="badge badge-important"><?php echo $notifyUser;?></span>
				<?php }?>
		</li>
		<?php }else{?>
		<li class="nav-item text-center <?php if($linkActive == 'login'){ echo 'active'; }?>"><a class="linkToProfile" href="javascript: showLogin();">Login</a></li>
		<?php }?>
    </ul>
    <?php if($page!='home'){?>
    <script type="text/javascript">
    (function(){
        //window.location.hash = "";
        setTimeout(function() {
            window.location.replace("#sectionMenu");
            $('.header').css({ opacity: 1 });
        }, 1);
    }());
    </script>
    <?php }?>

    <script type="text/javascript">
	function showLogin()
	{
		var modal = $('.modalLogin');
		$('.modalLogin').modal('show').css('display', 'block');
		$('.registerBlock', modal).removeClass('in').addClass('hide');
		$('.loginBlock', modal).removeClass('hide').addClass('in');
	}
	$(function(){
		var modal = $('.modalLogin');

		var swapLogin = $('<a href="index.php?page=register" target="_blank" class="swapLogin">Login</a>');
		var swapRegister = $('.swapRegister', modal);

		var loginBlock = $('.loginBlock', modal);
		var registerBlock = $('.registerBlock', modal);
		
		swapLogin.click(function(event){
			event.preventDefault();
			registerBlock.removeClass('in').addClass('hide');
			loginBlock.removeClass('hide').addClass('in');
		});

		swapRegister.click(function(event){
			event.preventDefault();
			loginBlock.removeClass('in').addClass('hide');
			registerBlock.removeClass('hide').addClass('in');
		});
		
		var loginButton = $('.loginButton', modal);
		loginButton.click(function(event){
			event.preventDefault();
			loginButton.button('loading');
			var email = $('.email', loginBlock).val();
			var password = $('.password', loginBlock).val();
			$.post('index.php?page=login.ajax', { email: email, password: password }, function(data){
				loginButton.button('reset');
				if(!data.success){
					if(data.code == 1001){
						$('.loginMessage', loginBlock).text(data.message).removeClass('hide').addClass('in');
						//$('.email-message', loginBlock).text(data.message).addClass('in');
					}
					else {
						//$('.email-message', loginBlock).removeClass('in');
					}
					
					if(data.code == 1002){
						$('.loginMessage', loginBlock).text(data.message).removeClass('hide').addClass('in');
						//$('.password-message', loginBlock).text(data.message).addClass('in');
					}
					else {
						//$('.password-message', loginBlock).removeClass('in');
					}

                    if(data.code == 1003){
                        $('.loginMessage', loginBlock).text(data.message).removeClass('hide').addClass('in');
                    }
					else {
						//$('.loginMessage', loginBlock).addClass('hide');
					}
					return;
				}
				if(typeof data.redir != 'undefined'){
					location.href = data.redir;
					return;
				}
				location.reload();
			}, 'JSON');
		});

		var registerButton = $('.registerButton', modal);

		$('.form-login').submit(function(event){
			event.preventDefault();
			loginButton.click();
		});

		var sending = false;
		registerButton.click(function(event){
			if(sending) return;
			event.preventDefault();
			
			var email = $('.email', registerBlock).val();
			var password = $('.password', registerBlock).val();
			var repeatPassword = $('.repeat-password', registerBlock).val();
			var phone = $('.phone', registerBlock).val();
			var name = $('.name', registerBlock).val();
			var address = $('.address', registerBlock).val();
			
			registerButton.button('loading');
			sending = true;
			$.post('index.php?page=register.ajax',
				{ email: email, password: password, repeatPassword: repeatPassword, phone: phone, name: name, address: address },
				function(data){
				registerButton.button('reset');
				sending = false;
				if(!data.success){
					$('.email-message', registerBlock).removeClass('in');
					$('.password-message', registerBlock).removeClass('in');
					$('.repeatPassword-message', registerBlock).removeClass('in');
					$('.phone-message', registerBlock).removeClass('in');
					$('.name-message', registerBlock).removeClass('in');
					$('.address-message', registerBlock).removeClass('in');
					$(data.errors).each(function(index, value){
						if(value.code == 1001){
							$('.email-message', registerBlock).text(value.message).addClass('in');
						}
						if(value.code == 1002){
							$('.password-message', registerBlock).text(value.message).addClass('in');
						}
						if(value.code == 1003){
							$('.repeatPassword-message', registerBlock).text(value.message).addClass('in');
						}
						if(value.code == 1004){
							$('.phone-message', registerBlock).text(value.message).addClass('in');
						}
						if(value.code == 1005){
							$('.name-message', registerBlock).text(value.message).addClass('in');
						}
						if(value.code == 1006){
							$('.address-message', registerBlock).text(value.message).addClass('in');
						}
						//$('.registerMessage', registerBlock).text(data.message).removeClass('hide').addClass('in');
					});
					registerButton.button('reset');
					return;
				}
				registerButton.attr('disabled', true);
				$('.modal-footer', registerBlock).slideUp();
				$('.registerForm').fadeOut(function(){
					$('.registerMessage', registerBlock).html('คุณได้ทำการสมัครเรียบร้อยแล้ว กรุณาเข้าไปที่ email เพื่อยืนยันการสมัครสมาชิก ')
					.append(swapLogin)
					.removeClass('hide')
					.addClass('alert-success').addClass('in');
				});
			}, 'JSON');
		});
	});
    </script>
    
    <?php }?>
    <div class="body <?php if($pageArr[0] != 'accounting'){ echo 'body-shadow'; }?>">